
//6.1编写一个Servlet应用程序，使用超链接在html和Servlet页面中建立通信

package com.example.homework1;

import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;


@WebServlet(name = "Servlet1", value = "/Servlet_1")
public class Servlet1 extends HttpServlet {
    private String message1;
    public void init() {
        message1 = "This is my first Servlet homework.";
    }
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html><body>");
        out.println("<h1>" + message1 + "</h1>");
        out.println("</body></html>");}}

